package com.cci.kangdao.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface ServiceCarTDao {
	
	/**
	 * 添加服务车
	 * @param type
	 * @return
	 */
	public int insertServiceCarT(Map<String, Object> map);
	
	/**
	 * 修改服务车
	 * @param type
	 * @return
	 */
	@Update("update ServiceCar_T set StationId=#{StationId},VIN=#{VIN},Updator=#{Updator},UpdateTime=#{UpdateTime} where ID=#{ID}")
	public int updateServiceCarT(Map<String, Object> map);
	
	/**
	 * 删除服务车
	 * @param type
	 * @return
	 */
	@Update("update ServiceCar_T set Flag=-1,Deleter=#{Deleter},DeleteTime=#{DeleteTime}  where ID=#{ID}")
	public int deleteServiceCarT(Map<String, Object> map);
	
	/**
	 * 根据服务站id查询所有服务车
	 * @param type
	 * @return
	 */
	@Select("select * from ServiceCar_T where StationId = #{StationId} and Flag=0")
	public List<Map<String, Object>> getServiceCarTListByServiceStationId(Map<String, Object> map);
	
	/**
	 * 根据服务车id查询服务车
	 * @param type
	 * @return
	 */
	@Select("select * from ServiceCar_T where ID=#{ID}")
	public Map<String, Object> getServiceCarTListByServiceCarId(Map<String, Object> map);
	
	/**
	 * 根据设备号和服务站id查询服务车
	 * @param type
	 * @return
	 */
	@Select("select count(*) from ServiceCar_T where VIN = #{VIN} and StationId = #{StationId} and Flag=0")
	public int getServiceCarTByVINStationId(Map<String, Object> map);

}
